<template>
  <div style="height: 4.3rem">
    <div class="top_box">
      <img
        style="cursor: pointer"
        @click="webopen()"
        src="../assets/image/logo.png"
        alt=""
      />
    </div>
    <div
      class="title_bj_box_1"
      style="
        height: 2rem;
        background-image: url('./static/img/2f76a6a5ed5416122abcda8e6ae6529.efabf4cc.png');
      "
    ></div>
    <div class="menu_box">
      <div class="menu_list_box">
        <router-link
          v-for="(item, index) in list"
          :key="index"
          :to="item.subroutername"
        >
          <div
            class="menu_item_box"
            :class="{ active: activeid == item.subroutername }"
          >
            <div class="menu_item">
              <div class="menu_img">
                <img
                  :src="
                    activeid == item.subroutername ? item.aimgurl : item.imgurl
                  "
                  alt=""
                />
              </div>
              {{ item.modname }}
            </div>
          </div>
        </router-link>
      </div>
    </div>
  </div>
</template>
<script>
import env from "../../env.js";

export default {
  props: {
    list: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {
      activeid: "gjs",
      url: env.API_BASE_URL,
    };
  },
  watch: {
    $route: {
      handler(val, oldval) {
        // console.log(val, oldval);
        //   console.log(val);
        this.activeid = JSON.parse(JSON.stringify(val.name));
        return this.activeid;
      },

      // 深度观察监听

      deep: true,
    },
  },
  mounted() {
    this.activeid = this.$route.name;
  },
  methods: {
    webopen() {
      window.open(this.url);
    },
    //  ==
  },
};
</script>
<style>
.el-header {
  margin: 0%;
  padding: 0;
  height: auto !important;
  width: auto;
}

.top_box {
  background-image: url("../assets/image/首页顶部背景.jpg");
  background-size: 100% 100%;
  height: 1.75rem;
  width: 100%;
  display: flex;
  align-items: center;
}
.top_box img {
  width: 10rem;
  margin-left: 4.3rem;
}
.title_bj_box_1 {
  /* background-image: url('../assets/image/2f76a6a5ed5416122abcda8e6ae6529.png'); */
  background-size: 100% 100%;
  height: 2rem;
}
.menu_box {
  margin-top: -0.6625rem;
}
.menu_list_box {
  width: 15rem;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.menu_item_box {
  width: 2.25rem;
  height: 1.325rem;
  background: #ffffff;
  /* box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15); */
  border: solid 1px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu_item_box:hover {
  animation: 1s;
  box-shadow: 4px 4px 4px 0px rgba(0, 0, 0, 0.15);
}
.menu_item{
  font-size: .2375rem;
}
.menu_list_box a {
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  text-decoration: none;
}
.menu_img {
  text-align: center;
}
.menu_img img{
  height: .4375rem;
}
.active {
  background: #1954a4;
  color: #ffffff;
}
</style>